package com.qf.kk.utils;
/*
 *@author KK on 2022.09.12 11:14
 */

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class StringUtils {
    //判断字符串是否为空
    public static boolean isNotEmpty(String...params){
        for (String str : params) {
            if (str==null||str.trim().length()==0){
                return false;
            }
        }
        return true;
    }

    //字符串日期类转util日期
    public static Date strToDate(String strDate){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            return sdf.parse(strDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

    //util日期转字符串日期
    public static String dateToStr(Date date){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(date);
    }
}
